<extend name="Layout/application"/>

<block name="content">
    <div class="row">
        <div class="col-md-12">

            <div class="row">
                <div class="col-md-8">
                    <div class="page-header">
                        <h1></h1>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <div class="panel-heading">文章列表</div>

                        <a href="{{:U('Article/create')}}" target="_self" class="btn btn-info addcate">添加文章</a>
                        <button type="submit" class="btn btn-danger destroy_checked">删除</button>


                        <div class="panel-body">
                            <table class="table">


                                <tr>
                                    <td><input type="checkbox" id="checkall" name="" value=""></td>
                                    <td>全选</td>

                                </tr>


                                <tr>

                                    <td><a><span class="glyphicon glyphicon-resize-vertical"></span></a></td>
                                    <td>标题</td>
                                    <td>所属栏目</td>
                                    <td>发布日期</td>
                                    <td><a><span class="glyphicon glyphicon-wrench"></span></a></td>
                                </tr>

                                <form method="post" action="" id="form">
                                <volist name="list" id="a">
                                <tr>

                                    <td><input type="checkbox" class="del_check" name="delete_id[]" value="{{$a.id}}"></td>
                                    <td><a><font color="{{$a.title_color}}">{{$a.title}}</a></td>
                                    <td>{{$a.category.name}}</td>
                                    <td>{{$a.time|date="Y-m-d",###}}</td>
                                    <td>
                                        <a href="{{:U('edit',array(id=>$a['id']))}}"><span class="glyphicon glyphicon-pencil"></span></a>
                                        <a href="{{:U('del',array(id=>$a['id']))}}"><span class="glyphicon glyphicon-remove"></span></a>
                                    </td>
                                </tr>
                                </volist>
                                </form>





                            </table>
                            <div class="pagination">{{$page}}</div>





                        </div>







                        </div>
                    </div>
                <div class="col-md-2">
                    <div class="list-group">
                        <a href="{{:U('create_article')}} " class="list-group-item list-group-item-info sort_category" >
                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新增 (add)
                        </a>
                        <a href="javascript: void 0;" class="list-group-item list-group-item-info sort_category" id="">
                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> 删除 (del)
                        </a>
                    </div>
                </div>
                </div>




            </div>
        </div>
    </div>
</block>
<block name="js">
    <script>
        $(function () {
            $("#checkall").click(function () {
                $(".del_check").prop("checked",this.checked);
            });
            $(".destroy_checked").click(function () {
                var length = $(".del_check:checked").length;
                if (length==0){
                    alert("你必须选取一个")
                    return false;
                }
                $("#form").attr('action',"{{:U('destroy_checked')}}").submit();

            })

        })

    </script>

</block>